<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
cfc('core')->checklogin('jy_jdpm/member.index/');
addmember();
$return=array();
$return['channel'] = pdo_getall('jy_jdpm_goods_group',array('uniacid'=>$_SESSION['uniacid'],'pid' => 0),'','','paixu asc');
if($_RQ['op']=='get'){
$membersinfo=pdo_get('jy_jdpm_member',array('mid'=>$_SESSION['uid']));
if(empty($membersinfo)){
	$id=addmember();
	$membersinfo=pdo_get('jy_jdpm_member',array('mid'=>$_SESSION['uid']));
}
$member=get_member($_SESSION['uid']);
$membersinfo=array_merge($membersinfo,$member);
$membersinfo['yuemoney']=price($membersinfo['credit2']-$membersinfo['wallet_pledge_freeze']);
$membersinfo['credit']=pdo_getsum('jy_jdpm_credit_log',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'fee >'=>0,'is_add'=>1),'fee');
$orderlist = pdo_getall('jy_weishop_order',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'plugin_name'=>'jy_jdpm'),'','','id desc');
foreach($orderlist as &$v){
		$good=get_goodsinfo($v['goodsid']);
		$v['image']=$good['image'];
		$v['name']=$good['title'];
		if($v['deftime1st']){
			$v['statusname']='买家违约';
		}elseif($v['deftime2st']){
			$v['statusname']='卖家违约';
		}else{
			$v['statusname']=$this->ordertypes()[$v['status']];
		}
}
$return['payAll'] = pdo_count('jy_weishop_order',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'status'=>0,'plugin_name'=>'jy_jdpm'),'id');
$return['shipmentsAll'] = pdo_count('jy_weishop_order',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'status'=>1,'plugin_name'=>'jy_jdpm'),'id');
$return['takeAll'] = pdo_count('jy_weishop_order',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'status'=>2,'plugin_name'=>'jy_jdpm'),'id');
$return['info']=$membersinfo;
$return['orderlist']=$orderlist;
        // 账户安全等级
        $score = 0;
        if ($membersinfo['verify_mobile'] == 1) {
            $score += 20;
        }
        if ($membersinfo['verify_email'] == 1) {
            $score += 20;
        }
        if ($membersinfo['idcard_check'] == 2) {
            $score += 20;
        }
        if (!empty($membersinfo['question'])) {
            $score += 20;
        }
$return['moneylogall']=pdo_getsum('jy_jdpm_money_log',array('mid'=>$_SESSION['uid'],'type' => 3),'money');
$return['score']=$score;
$addcredit = pdo_getsum('jy_jdpm_credit_log',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'is_add'=>1),'fee');
$feecredit = pdo_getsum('jy_jdpm_credit_log',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'is_add'=>0),'fee');
$return['allcredit'] = price($addcredit['fee'] - $feecredit['fee']);
set_html('title','会员中心');
exi($return);
}
